package task21;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/4/8 10:33
 * @description:长方形类 定义长，宽
 */
public class Rectangle {

  //封装：
  private int width;
  private int height;
  //封装方法

  public int getWidth() {
    return width;
  }

  public void setWidth(int width) {
    this.width = width;
  }

  public int getHeight() {
    return height;
  }

  public void setHeight(int height) {
    this.height = height;
  }

  //构造方法
  Rectangle() {}

  Rectangle(int width, int height) {
    this.height = height;
    this.width = width;
  }
  //特殊方法
  void cirumference() {
    int c = (width + height) * 2;
    System.out.println("周长是" + c);
  }
  //面积

  int area() {
    int a = width * height;
    return a;
  }
}

